using System;
using System.Collections.Generic;
using System.IO;
using System.Xml;
using log4net;
using Triton.Common.LogUtilities;

namespace Triton.Common
{
	public class ArenavaluesReader
	{
		private static readonly ILog ilog_0 = Logger.GetLoggerInstanceForType();

		private const string string_0 = "./ArenaValues.xml";

		public Dictionary<string, int> ArenaValues = new Dictionary<string, int>();

		private static ArenavaluesReader arenavaluesReader_0 = null;

		public static ArenavaluesReader Get
		{
			get
			{
				if (arenavaluesReader_0 == null)
				{
					arenavaluesReader_0 = new ArenavaluesReader();
					arenavaluesReader_0.ReadXML();
				}
				return arenavaluesReader_0;
			}
		}

		public void ReadXML()
		{
			try
			{
				using XmlReader xmlReader = XmlReader.Create(new StringReader(File.ReadAllText("./ArenaValues.xml")));
				while (xmlReader.ReadToFollowing("arena-value"))
				{
					try
					{
						xmlReader.MoveToFirstAttribute();
						string value = xmlReader.Value;
						xmlReader.MoveToNextAttribute();
						int value2 = int.Parse(xmlReader.Value);
						ArenaValues.Add(value, value2);
					}
					catch (Exception ex)
					{
						ilog_0.Error("Error during arenavalues parsing : " + ex.Message);
					}
				}
			}
			catch (Exception ex2)
			{
				ilog_0.Error("Error during ./ArenaValues.xml parsing : " + ex2.Message);
			}
		}
	}
}
